package com.woniuxy.until;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * FileName: ResponseData
 * Author: wujiajun
 * Date:   2024/12/25 15:32
 * Description:DOTO
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseData<T> {
    private Integer code;
    private T data;
    private String msg;

    /**
     * 成功的方法
     */
    public  ResponseData success(){
        return new ResponseData(ResponseEnum.SUCCESS.getCode(),null,ResponseEnum.SUCCESS.getMsg());
    }
    public   ResponseData success(T data){
        return new ResponseData(ResponseEnum.SUCCESS.getCode(),data,ResponseEnum.SUCCESS.getMsg());
    }

    /**
     * 失败的方法
     */
    public  ResponseData fail(ResponseEnum responseEnum){
        return new ResponseData(responseEnum.getCode(),null,responseEnum.getMsg());
    }



}
